home *** CD-ROM | disk | FTP | other *** search
- #include "QD3DtoQTVR.h"
- #include "extern.h"
- #include "draw.h"
-
-
- void MyDrawOnScreen(DocumentPtr theDocument)
- {
- LockPixels(theDocument->drawContextOffscreen->portPixMap);
- SetGWorld(theDocument->theWindow,nil);
- CopyBits((BitMap*)&theDocument->drawContextOffscreen->portPixMap,
- (BitMap*)&theDocument->theWindow->portPixMap,
- &theDocument->drawContextOffscreen->portRect,
- &theDocument->theWindow->portRect,
- srcCopy,
- nil);
- UnlockPixels(theDocument->drawContextOffscreen->portPixMap);
- }
-
-
- TQ3Status MyDrawOffScreen(DocumentPtr theDocument)
- {
- TQ3DrawContextObject drawCtx;
- TQ3Vector3D globalScale;
- TQ3Vector3D globalTranslate;
- RGBColor whiteColor = kMyWhiteColor;
- RGBColor blackColor = kMyBlackColor;
- GWorldPtr oldPort;
- GDHandle oldGD;
-
- GetGWorld(&oldPort,&oldGD);
-
- if(theDocument == NULL)
- return kQ3Success;
-
- Q3View_GetDrawContext(theDocument->theView, &drawCtx);
-
- if( theDocument->documentGroup ) {
- globalScale.x = globalScale.y = globalScale.z = theDocument->documentGroupScale;
- Q3Vector3D_Scale(&globalTranslate, -1, &globalTranslate);
- Q3View_StartRendering(theDocument->theView);
-
- do {
- TQ3SubdivisionStyleData subData = {kQ3SubdivisionMethodConstant, 20, 20};
-
- Q3Shader_Submit(theDocument->illuminationShader, theDocument->theView);
-
- Q3InterpolationStyle_Submit(theDocument->currentInterpolation,theDocument->theView);
-
- Q3SubdivisionStyle_Submit( &subData,theDocument->theView);
-
- Q3MatrixTransform_Submit( &theDocument->modelRotation, theDocument->theView);
- Q3ScaleTransform_Submit(&globalScale, theDocument->theView);
-
- Q3DisplayGroup_Submit(theDocument->documentGroup, theDocument->theView);
- } while (Q3View_EndRendering(theDocument->theView) == kQ3ViewStatusRetraverse);
- }
-
- Q3Object_Dispose( drawCtx );
- SetGWorld(oldPort,oldGD);
-
- return(kQ3Success);
- }
-